package at.fhj.itm09.snake.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import at.fhj.itm09.snake.R;

/**
 * 
 * @author Susanne Brandstätter - Susanne.Brandstaetter.ITM09@fh-joanneum.at
 * @author Katharina Biela - Katharina.Biela.ITM09@fh-joanneum.at
 *
 * This class is the main activity which is also started when the application
 * is started. 
 * In this activity you can start the game, do some settings and end the application. 
 * It doesn't have any logic, it only starts another activity by clicking on the buttons.
 * 
 */

public class SnakeActivity extends Activity 
	implements OnClickListener{
    /** Called when the activity is first created. */
	
	private Button playButton;
	private Button settingsButton;
	private Button finishButton;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        playButton = (Button) findViewById(R.id.btn_play);
        settingsButton = (Button) findViewById(R.id.btn_settings);
        finishButton = (Button) findViewById(R.id.btn_finish);
        	
        playButton.setOnClickListener(this);
        settingsButton.setOnClickListener(this);
        finishButton.setOnClickListener(this);
        
    }

	@Override
	public void onClick(View v) {
		if(finishButton.isPressed()){
			this.finish();
		}
		
		if(playButton.isPressed()){
			Intent playIntent = new Intent(this, PlaySnakeActivity.class);
			startActivity(playIntent);
		}
		
		if(settingsButton.isPressed()){
			Intent settingsIntent = new Intent(this, SettingsActivity.class);
			startActivity(settingsIntent);
		}
		
	}
}